<extend name="public@base5"/>

<block name="main">

    <div class="wrap">
        <ul class="nav nav-tabs">
            <li class="nav-item">
                <a class="nav-link" href="{:url('task/medal_list')}">勋章列表</a>
            </li>
            <li class="nav-item">
                <a class="nav-link active" href="{:url('task/add_medal')}">添加勋章</a>
            </li>
        </ul>
        <form method="post" class="js-ajax-form margin-top-20" action="admin/task/save_medal">
            <input type="hidden" name="id" value="{$id|default=0}">
            <div class="row mb-3">
                <label for="input-medal_name" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>勋章名称</label>
                <div class="col-md-4 col-sm-4">
                    <input type="text" class="form-control" id="input-medal_name" name="medal_name" value="{$medal_name|default=''}" placeholder="勋章名称">
                </div>
            </div>

            <div class="row mb-3">
                <label for="input-task_req" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>勋章类型</label>
                <div class="col-md-4 col-sm-4">
                    <select id="medal_key" name="medal_key" class="form-control" >
                        <if condition="$medal_key eq 0">
                            <option value="0" selected>成长勋章</option>
                            <option value="1">推广勋章</option>
                        <else/>
                            <option value="0" >成长勋章</option>
                            <option value="1" selected>推广勋章</option>
                        </if>
                    </select>
                </div>
            </div>
            <div class="row mb-3">
                    <label for="medal_url" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>图标</label>
				<div class="col-md-8 col-sm-10">
					<input type="hidden" name="medal_url" id="medal_url"
                                       value="{$medal_url|default=''}">
                                <a href="javascript:uploadOneImage('图片上传','#medal_url');">
                                    <if condition="empty($medal_url)">
                                        <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                             id="medal_url-preview"
                                             width="135" style="cursor: pointer"/>
                                        <else/>
                                        <img src="{:cmf_get_image_preview_url($medal_url)}"
                                             id="medal_url-preview"
                                             width="135" style="cursor: pointer"/>
                                    </if>
                                </a>
				</div>
            </div>
            <div class="row mb-3">
                <label for="input-task_desc" class="col-sm-2 col-form-label text-sm-end"><span class="form-required">*</span>勋章描述</label>
                <div class="col-md-4 col-sm-4">
                    <input type="text" class="form-control" id="input-task_desc" name="medal_desc" value="{$medal_desc|default=''}" placeholder="勋章描述" >
                </div>
            </div>

            <div class="row mb-3">
                <div class="offset-md-2 col-sm-10">
                    <button type="submit" class="btn btn-primary js-ajax-submit">
                        <i class="fa fa-save fa-fw"></i> {:lang('SAVE')}
                    </button>
                </div>
            </div>
        </form>
    </div>
</block>

<block name="scripts">
    <script src="__STATIC__/js/mall.js"></script>
</block>